import request from '@/utils/request'

/**
 * 小区内容渲染
 */
export function getCommunityApi() {
  return request({
    url: '/community'
  })
}

/**
 * 收费明细列表
 * @param {*} params
 * @returns
 */
export function getexpenseslistApi(params) {
  return request({
    method: 'GET',
    url: '/expenses/index',
    params
  })
}
/**
 * 删除
 */
export function delexpenseslistApi(id) {
  return request({
    method: 'DELETE',
    url: `/expenses/index/${id}`
  })
}

// 根据小区的id
export const getExpensesByComIdApi = (params) => {
  return request({
    url: '/house/index',
    method: 'get',
    params
  })
}

// 获取到小区code的id去调用收费项目的数据
export const getProjectApi = (params) => {
  return request({
    url: '/expenses/project',
    method: 'get',
    params
  })
}

// 收费明细管理中的新增小区
export const getBuildingApi = (params) => {
  return request({
    url: '/house/building',
    method: 'get',
    params
  })
}

// 收费明细新增的所属楼栋切换
export const getBuildingCodeApi = (params) => {
  return request({
    url: '/house/index',
    method: 'get',
    params
  })
}

// 收费项目新增按钮
export const getAddIndexApi = (data) => {
  return request({
    url: '/expenses/index',
    method: 'post',
    data
  })
}

// 收费明细的修改
export const getEditIndexApi = (id) => {
  return request({
    url: `/expenses/index/${id}`
  })
}

// 收费明细的修改确定
export const getUpdataIndexApi = (data) => {
  return request({
    url: `/expenses/index/${data.id}`,
    method: 'PUT',
    data
  })
}
